﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;

namespace Flagwind.Security
{
	/// <summary>
	/// 表示安全凭证作废时的事件参数。
	/// </summary>
	[Serializable]
	public class CredentialInvalidatedEventArgs : EventArgs
	{
		#region 成员字段

		private CredentialInvalidatedReason _reason;
		private Credential _credential;

		#endregion

		#region 公共属性

		/// <summary>
		/// 获取作废的凭证实例。
		/// </summary>
		public Credential Credential
		{
			get
			{
				return _credential;
			}
		}

		/// <summary>
		/// 获取凭证作废的原因。
		/// </summary>
		public CredentialInvalidatedReason Reason
		{
			get
			{
				return _reason;
			}
		}

		#endregion

		#region 构造方法

		/// <summary>
		/// 初始化 <see cref="CredentialInvalidatedEventArgs"/> 类的新实例。
		/// </summary>
		/// <param name="credential">凭证实例。</param>
		/// <param name="reason">作废原因。</param>
		public CredentialInvalidatedEventArgs(Credential credential, CredentialInvalidatedReason reason)
		{
			if(credential == null)
				throw new ArgumentNullException(nameof(credential));

			this._credential = credential;
			this._reason = reason;
		}

		#endregion
	}
}
